package com.ddzh.web;

import com.ddzh.dto.RoleDto;
import com.ddzh.dto.RoleMenuDto;
import com.ddzh.entity.Result;
import com.ddzh.service.RoleMenuService;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/roleMenuController")
public class RoleMenuController {

    @Reference
    private RoleMenuService roleMenuService;

    @GetMapping("/findMenuIdsByRoleId/{roleId}")
    public Result findMenuIdsByRoleId(@PathVariable("roleId")Long roleId){
        return new Result(roleMenuService.findMenuIdsByRoleId(roleId));
    }


    @PostMapping("/allocateMenu")
    public Result allocateMenu(@RequestBody RoleMenuDto roleMenuDto){
        return new Result(roleMenuService.allocateUserMenu(roleMenuDto));
    }
}
